<? if(!empty ($offer) || 1) { 
    $offer = $this->offer
            ?>
    <table class="datalist" width="100%">
            <thead>
                <tr>
                    <th colspan="4">Oferta</th>  
                    <td> #<? echo $offer->getOffer_id(); ?></td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="4">Max wiązek</td>
                    <td><? echo $offer->getMaxVolume(); ?></td>    
                </tr>
                <? $components = $offer->getComponents(); ?>
                <?                
                foreach ($components as $component){
                ?>
                <tr>
                    <th scope="row" width="30%"><? echo $component->getCommodity()->getName(); ?></th>
                    <td  width="20%"><? if($component->getShareFactor() == -1){
                             echo 'Sprzedaż';
                         } elseif($component->getShareFactor() == 1) {
                             echo 'Kupno';
                         }
                    ?></td>
                    <td  width="10%"><? echo $component->getQuantity()?></td>
                    <td width="20%">
                        <a href="<? 
                            echo $this->url(
                                    array('controller' => 'commodities',
                                        'action' => 'add',
                                        'format' => 'html',
                                        'type' => 'old',
                                        'commodity' => $component->getCommodity_id(),
                                        'offer' => $offer->getOffer_id(),
                                        )
                                    ); ?>" class="nyroModal">
                           Zmień
                        </a>
                    </td>
                    <td width="20%">
                        <a href="<? 
                            echo $this->url(
                                    array('controller' => 'commodities',
                                        'action' => 'remove',
                                        'commodity' => $component->getCommodity_id(),
                                        'offer' => $offer->getOffer_id(),
                                        )
                                    ); ?>">
                           Usuń
                        </a>
                    </td>
                </tr> 
                <? } ?>
                <tr>
                    <td colspan="4">
                        Koszt
                    </td>
                    <td>
                        <? echo $offer->getOfferedPrice(); ?>
                    </td>
                </tr>
            </tbody>
    </table>
<? } ?> 
